package com.example.departmentService.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.departmentService.entity.ProjectInfo;
import com.example.departmentService.entity.ProjectMember;
import com.example.departmentService.entity.RecruitmentInfo;
import com.example.departmentService.entity.dto.QueryConditions;
import com.example.departmentService.entity.vo.ProjectListVo;
import com.example.departmentService.mapper.RecruitmentInfoMapper;
import com.example.departmentService.service.IRecruitmentInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class RecruitmentInfoServiceImpl extends ServiceImpl<RecruitmentInfoMapper, RecruitmentInfo> implements IRecruitmentInfoService {
    @Resource
    private RecruitmentInfoMapper recruitmentInfoMapper;

    @Override
    public List<RecruitmentInfo> findAll() {
        List<RecruitmentInfo> recruitmentInfos = recruitmentInfoMapper.selectList(null);
        return recruitmentInfos;
    }

    @Override
    public Integer insert(RecruitmentInfo recruitmentInfo) {

        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        sdf.format(date.getTime());


        RecruitmentInfo recruitmentInfo1 = new RecruitmentInfo();
        recruitmentInfo1.setRecruitId(recruitmentInfo.getRecruitId());
        recruitmentInfo1.setTime(sdf.format(date.getTime()));
        recruitmentInfo1.setRecruitPlace(recruitmentInfo.getRecruitPlace());
        recruitmentInfo1.setMoney(recruitmentInfo.getMoney());
        recruitmentInfo1.setState(recruitmentInfo.getState());
        int item = recruitmentInfoMapper.insert(recruitmentInfo1);
        return item;
    }


}
